package com.jiao.mydd.controller;

import com.jiao.mydd.dao.mapper.BookMapper;
import com.jiao.mydd.pojo.Books;
import com.jiao.mydd.service.BooksService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/books")
public class BooksControllerImpl {

    @Autowired
    BooksService booksService;

    @Autowired
    private BookMapper bookMapper;

    @GetMapping("/book/{id}")
    public Books getBooks(@PathVariable Integer id) {
        return booksService.getbook(id);
    }

    @GetMapping("/books1")
    public void getBook() {
        List<Books> bookAll = bookMapper.getBookAll();
        System.out.println();
    }
}
